import Vue from 'vue'
import Router from 'vue-router'
import iapp from '@/App'
import channel from 'components/channel/channel'
import shouye from 'components/shouye/shouye'
import space from 'components/space/space'
import login from 'components/login/login'
Vue.use(Router)
//export default router = 
const router = new Router({
  routes: [
//  {
//    path: '/app',
//    name: 'App',
//    component: iapp
//  },
    {
      path: '/channel/:tid',
      name: 'channel',
      component: channel
    },
    {
      path: '/',
      name: 'shouye',
      component: shouye
    },
    {
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/space',
      name: 'space',
      component: space,
      meta:{
      	requireAuth:true
      },
    },
  ]
})

//全局布局
//router.beforeEach((to,from,next)=>{
//	if(to.matched.some(record=>record.meta.requireAuth)){
//		if(localStorage.getItem("isLogin")){
//			next()
//		}else{
//			next({
//				path:'/login',
//				query:{
//					redirect:to.fullPath
//				}
//			})
//		}
//	}else{
//		next()
//	}
//	console.log(to)
//	console.log(from)
//	next()
//})
export default router